package org.raytracer.algo;

public class Vec3 
{
	public Vec3(double x, double y, double z) {
		super();
		this.x = x;
		this.y = y;
		this.z = z;
	}
	
	public void normalize()
	{
		double r = Math.sqrt(x*x+y*y+z*z);
		x/=r;
		y/=r;
		z/=r;	
	}
	
	//get a normalized dir for start to end
	public static Vec3 getNormalizedDir(Vec3 start,Vec3 end)
	{
		Vec3 dir = new Vec3(end.x-start.x,end.y-start.y,end.z-start.z);
		dir.normalize();
		return dir;
	}

	public double x,y,z;
}
